package com.company.笔试.二进制加法;

/**
 * @author ylr
 * @version 1.0.0
 * @ClassName Solution.java
 * @Description TODO
 * @createTime 2021年12月24日 09:33:00
 */
public class Solution {
    public static void main(String[] args) {
//        String a = "10";
//        String b = "11";
        String a ="10100000100100110110010000010101111011011001101110111111111101000000101111001110001111100001101";
        String b ="110101001011101110001111100110001010100001101011101010000011011011001011101111001100000011011110011";
        String[] aL = a.split("");
        String[] bL = b.split("");
        int aInt=0;
        int bInt=0;
        for (int i=aL.length-1,j=0;i>=0;i--,j++) {
            if (aL[i].equalsIgnoreCase("1")){
                aInt+=Math.pow(2,j);
            }
        }
        for (int i=bL.length-1,j=0;i>=0;i--,j++) {
            if (bL[i].equalsIgnoreCase("1")){
                bInt+=Math.pow(2,j);
            }
        }
        System.out.println(Integer.toBinaryString(aInt+bInt));
    }
}
